 <template>
  <d2-container-frame :src="filename"/>
</template>

<script>
import * as callcenter from "@/api/callcenter";
import { mapGetters, mapState } from "vuex";
// Import component
import Loading from "vue-loading-overlay";
// Import stylesheet
import "vue-loading-overlay/dist/vue-loading.css";

export default {
  components: {
    Loading
  },
  data() {
    return {
      filename: ''
    };
  },
  computed: {
    // ...mapGetters(['permissions']),
    // ...mapState('d2admin/user', ['info'])
  },
  filters: {
  },
  computed: {
    // ...mapGetters(['permissions']),
    ...mapState("d2admin/user", ["info"])
  },
  created() {
    this.callTimeLog()
  },
  methods: {
    callTimeLog() {
      let paths = this.$route.path.split('/')
      let reportlet = paths[paths.length-1]
      let params = {}
      params.reportlet = reportlet
      callcenter.callTimeLog(params).then(response => {
        let resp = response.data
        this.filename = resp.url //'http://39.107.237.7:9031/WebReport/ReportServer?reportlet=callTimeLog.cpt&pmStart='+resp.pmStart+'&amEnd='+resp.amEnd+'&currentDate=' + resp.currentDate + '&createId=' + resp.createId
      });
    }
  },
  watch: {
    '$route' (to, from) {
      this.callTimeLog()
    }
  }
};
</script>
<style lang="scss" scoped>
.d2-mb {
  float: left;
  margin-right: 20px;
}
.d2-mb .el-button i {
  margin-right: 4px;
}
</style>
